import React, { useEffect, useState } from 'react'
import { useNavigate } from 'react-router-dom'
function UsLogin() {
    let navigate=useNavigate()
    const [islogin,setIslogin]=useState(false)
  let token=localStorage.getItem('token')
  useEffect(()=>{
    if(token){
        setIslogin(true)
    }else{
        setIslogin(false)
        navigate('/login')
    }
  })
  return {islogin:islogin}
}

export default UsLogin